//
//  Topic.swift
//  Gaoloumi
//
//  Created by Jasper on 4/1/16.
//  Copyright © 2016 Jasper. All rights reserved.
//

import UIKit
import AVOSCloud

let kTopicKeyTitle: String = "title"                  // 标题
let kTopicKeyContent: String = "content"              // 内容
let kTopicKeyContentImage: String = "contentImage"    // 图片 最多3张
let kTopicKeyClickCount: String = "clickCount"        // 点击次数  （ 如何做到请求一次就自动加1？ ）
let kTopicKeyReplyCount: String = "replyCount"        // 回贴条数   (如何在服务器端实现)
let kTopicKeyLastReplyTime: String = "lastReplyTime"  // 最后回帖时间 (如何在服务器端实现) // updateTime????
let kTopicKeyIsInTop: String = "isInTop"              // 是否置顶
let kTopicKeyIsDelete: String = "isDelete"            // 是否删除，避免误删除，可以恢复
let kTopicKeyIsCommend: String = "isCommend"          // 是否推荐阅读，精华帖
let kTopicKeyIsUserName: String = "userName"          // 用户名
let kTopicKeyIsReported: String = "isReported"        // 是否被举报


let kTopicKeyCitys: String = "city"          // 所属城市  Pointers 存储关联
let kTopicKeyUser: String = "user"           // 作者 发帖人 Pointers 存储关联

// 发帖时间就是默认的creatTime
// 每回一次贴多更新一下

class Topic: AVObject {
    @NSManaged var title: String?
    @NSManaged var content: String?
    @NSManaged var contentImage: [AVFile]?
    @NSManaged var clickCount: Int
    @NSManaged var replyCount: Int
    @NSManaged var lastReplyTime: Date?  //  有没有必要
    @NSManaged var isInTop: Bool
    @NSManaged var isDelete: Bool
    @NSManaged var isCommend: Bool
    @NSManaged var userName: String?  // 主题人名
    @NSManaged var isReported: Bool
    
    @NSManaged var city: City?
    @NSManaged var user: AVUser?
    
    static func parseClassName() -> String! {
        return "Topic"
    }
}
